package org.testis.webautomationmodule.ui.objects;

import org.testis.webautomationmodule.ui.UIBehaviorDecorator;


public class UIValidationAlert extends UIBehaviorDecorator
{

    private String m_alertMsg;


    public UIValidationAlert()
    {
    }


    @Override
    protected boolean setBehavior()
    {
         String hasAlerts = getWebAutomationImpl().getEval(
            "selenium.browserbot.hasAlerts();");
        if (hasAlerts.equals("true")) {
            setAlertMsg(getWebAutomationImpl().getAlert());
            putLog(" Got  validation alert with the message (" + getAlertMsg() +
                   ")");
            return false;
        }
        else {
            return true;
        }
    }

    public String getAlertMsg()
    {
        return m_alertMsg;
    }


    private void setAlertMsg(String alertMsg)
    {
        this.m_alertMsg = alertMsg;
    }
}
